This is a companion function to change-length sharing the same operators. The difference lies in the way it changes or modifies note-length vales as ratios; change-length converts note-length ratios to ticks.
The <operators> are:
:add - adds value to length-values
:sub - subtracts value from length-values
:times - multiplies length-values by value
:divide - divides length-values by value
Unlike type-value it is possible to isolate modifications to via the <type> paramter using :rest, :note or :all.
The <type> options are:
:rest - rest value
:note - length value
:all - rest and length values
In these examples the <type> parameter modifies first rests-lengths then note-lengths (abbreviated to :rest and :note.)
(setq len1 (qlength '8-1010))
(l-modify .45 nil :all :sub '1/16 len1)
=> (1/16 -1/16 1/16 -1/16)
(l-modify .45 1 :note :add '1/16 len1)
=> (3/16 -1/8 1/8 -1/8)
(l-modify .45 1 :note :divide 4 len1)
=> (1/32 -1/8 1/8 -1/8)
(l-modify nil 2 :all :times 4 len1)
=> (1/2 -1/8 1/8 -1/2)
or (1/8 -1/2 1/2 -1/8) ...
Also, with the parameter <count> it is possible isolate particular note-lengths and using a list with the operator value provide different values for these isolated note-lengths.
(l-modify .45 2 :rest :times '(5 3) len1)
=> (1/8 -5/8 1/8 -3/8)
The following examples show that by making the seed value nil modifications to a selected number of note-lengths / rest-lengths may be randomized.
(l-modify nil 2 :all :times 4 len1)
=> (1/8 -1/8 1/2 -1/2)
or (1/2 -1/8 1/8 -1/2)
or (1/2 -1/8 1/2 -1/8) ...
(l-modify nil 2 :all :times '(5 3) len1)
=> (1/8 -1/8 5/8 -3/8)
(1/8 -5/8 3/8 -1/8) ...
The function works equally well on single and multiple lists of note-lengths.